@layout("/common/_container.html"){
<div class="ibox float-e-margins">
    <div class="ibox-content">
        <div class="form-horizontal" id="fileInfoForm">
            <form id="uploadForm" enctype="multipart/form-data" method="post">
                上传文件：<input type="file" name="file1"><br/>
                <input type="button" id="upload" value="提交">
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
    var FileInfoDlg = {
        fileInfoData: {},
        validateFields: {}
    };
    FileInfoDlg.close = function () {
        parent.layer.close(window.parent.File.layerIndex);
    }
    $(function () {
        Feng.initValidator("fileInfoForm", FileInfoDlg.validateFields);


        $("#upload").click(function () {
            var formData = new FormData($('#uploadForm')[0]);
            $.ajax({
                type: 'post',
                url: "/hp/file/upload", //上传文件的请求路径必须是绝对路劲
                data: formData,
                cache: false,
                processData: false,
                contentType: false,
            }).success(function (data) {
                Feng.success(data.resultMsg);
                window.parent.File.table.refresh();
                FileInfoDlg.close();
            }).error(function () {
                alert("上传失败");
            });
        });
    });
</script>
@}
